#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<QNetworkAccessManager>
#include<QNetworkRequest>
#include<QNetworkReply>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    manager=new QNetworkAccessManager(this);

}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
    QUrl url(ui->lineEdit->text());
    QNetworkRequest request(url);
    QNetworkReply* reply=manager->get(request);
    connect(reply,&QNetworkReply::finished,this,[=](){
        ui->textEdit->setMarkdown(reply->readAll().toPercentEncoding());
        reply->deleteLater();
    });
}
